# =============================================================================
# Find packages: SDL
if(OS_WINDOWS)
  set(SDL_ROOT ${COMMON_THIRD_LIB}/SDL/$<CONFIG>)
endif()

macro(use_sdl ag_project_name)
  target_compile_definitions(${ag_project_name} PRIVATE USE_LIB_SDL)
  target_compile_definitions(${ag_project_name} PRIVATE ${ARGN})

  # SDL 依赖下面这些
  target_link_libraries(${ag_project_name} PRIVATE Imm32 Winmm Version Cfgmgr32 OneCoreUAP)

  # SDL 库
  target_include_directories(${ag_project_name} PRIVATE ${SDL_ROOT}/include)
  target_include_directories(${ag_project_name} PRIVATE ${SDL_ROOT}/include/SDL2)
  target_link_directories(${ag_project_name} PRIVATE ${SDL_ROOT}/lib)
  target_link_libraries(${ag_project_name} PRIVATE SDL2-static$<$<CONFIG:Debug>:d>)

  target_link_options(${ag_project_name} PRIVATE "/NODEFAULTLIB:msvcrt.lib")
  target_link_options(${ag_project_name} PRIVATE "/NODEFAULTLIB:msvcrtd.lib")
endmacro(use_sdl)